package common

import (
	"regexp"
)

func checkGitUrl(url string) bool {
	reg := regexp.MustCompile(`^((git|ssh|http(s){0,1})|(git@[\w\.]{1,}))(:(//){0,1})([\w\.@:/\-~]{1,})(/){0,1}$`)
	return reg.MatchString(url)
}

func checkHttpGitUrl(url string) bool {
	reg := regexp.MustCompile(`^(http(s){0,1})(:(//){0,1})([\w\.@:/\-~]{1,})(/){0,1}$`)
	return reg.MatchString(url)
}

func checkSshGitUrl(url string) bool {
	reg := regexp.MustCompile(`^((git|ssh)|(git@[\w\.]{1,}))(:(//){0,1})([\w\.@:/\-~]{1,})(/){0,1}$`)
	return reg.MatchString(url)
}